Skip to content

fix(connections): restore socket authentication and preserve TCP TLS checks - #1563

Merged
debba merged 1 commit into
mainfrom
fix/socket-transport-regressions
Nov 16, 2026
Merged

debba merged 1 commit into
mainfrom
fix/socket-transport-regressions

Conversation

@debba

@debba debba commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Switching PostgreSQL from TCP to a Unix socket could still load inactive TLS certificate files and fail before connecting. MySQL 8.4 socket connections using caching_sha2_password also failed with valid credentials: SQLx 0.8.6 sent an RSA key request even though MySQL treats a Unix socket as a secure transport and expects the password.

Force the PostgreSQL TLS connector to match its SSL-disabled local socket configuration. Preserve TCP and tunnel TLS validation. Patch SQLx's full SHA-2 authentication to recognize the actual local socket transport, retaining RSA for unencrypted TCP and keeping TLS verification unchanged.

The SQLx change uses a local snapshot of sqlx-mysql 0.8.6 with the original licenses. Only three upstream source files differ (the transport flag, its propagation, and the authentication condition); src-tauri/vendor/sqlx-mysql/README.tabularis.md documents the exact changes and removal criteria. Other SQLx crates and versions remain unchanged.

Validation on d391908e41a699fd907325e0b82ee6d98b585c13, based on main after #957, #1111, #1250, #1441 and #1520:

  • Full desktop-free Rust suite: 2,713 passed, including 2,708 library tests; 242 opt-in tests ignored. The two new opt-in socket integration regressions were also executed separately against real PostgreSQL 16 / MySQL 8.4 and passed, including cold-cache MySQL authentication.
  • Full frontend suite: 607 files / 9,622 tests passed. An earlier full run had one RowEditorPanel plugin-probe timeout; that file passed all four tests in isolation and the complete rerun passed. Its root cause remains unconfirmed; no frontend source/test changes are included here.
  • Production frontend build/typecheck and locked server-only binary build passed.
  • 13 real Chromium scenarios passed: nine against PostgreSQL 16 / MySQL 8.4 and four against MySQL 5.7. Each driver/transport exercises Test Connection, saved settings, CRUD, SQL editor, notebook Running → Output available → Failed → recovery → cleared, startup scripts, pool reconnect, query cancellation and a successful query afterwards. Additional cases cover missing inactive TLS files, incorrect passwords, explicitly disabled TCP TLS and PostgreSQL TCP refusing a required-TLS connection to a non-TLS server.
  • CI now runs the socket regressions alongside PostgreSQL 16 and MySQL 5.7/8.4 integration jobs, with database sockets mounted into the runner.
  • GitNexus impact on the shared PostgreSQL connector was CRITICAL (test connection, pool and cancellation callers). detect_changes checked the staged/compare scope. Vendor code is excluded from the graph; its three source-file differences were compared directly to the published 0.8.6 crate and reviewed manually.

The UI verification used Chromium and the shared web backend/driver implementation. Native desktop/WebKit was not executed. Disposable database containers were stopped after testing. All CI checks are green on d391908, including the aggregate test job, PostgreSQL, MySQL 5.7/8.4 and web-e2e. Kilo Code Review reports no issues. GitHub reports CLEAN/MERGEABLE.

Manual verification with disposable PostgreSQL/MySQL databases:

  1. Create a normal host/port connection and execute a query. Save and reconnect.
  2. Switch to its local Unix socket, retaining TLS file paths from TCP; Test Connection and query execution must succeed.
  3. Execute a slow SQL notebook cell (SELECT 'probe' FROM pg_sleep(1) on PostgreSQL; SELECT 'probe' FROM DUAL WHERE SLEEP(1)=0 on MySQL): outline shows Running, then Output available. Run invalid SQL, verify Failed, correct it and rerun, then clear outputs.
  4. Switch back to TCP: valid settings work; missing CA/client files in verification modes must fail. An incorrect MySQL password must fail in both modes.

The isolated Rust socket regressions are in src-tauri/tests/socket_integration.rs (run with --ignored and MYSQL_UNIX_SOCKET / PG_UNIX_SOCKET). Use only disposable databases: the MySQL test runs FLUSH PRIVILEGES to exercise cold authentication.

@debba
debba marked this pull request as ready for review November 16, 2026 09:06
@kilo-code-bot

kilo-code-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The PR changes are small and focused. The PostgreSQL TLS connector now forces the Disable choice for local sockets, and TCP and tunnel connections still validate their TLS settings. The vendored sqlx-mysql 0.8.6 adds an is_local_socket flag. The flag is set from options.socket, kept when the stream is boxed or wrapped in TLS, and used in the full SHA-2 authentication check. I did not diff the vendored crate against the published 0.8.6 source, and I did not run any code or tests.

Files Reviewed (83 files)
  • .github/workflows/mysql-integration.yml
  • .github/workflows/pg-integration.yml
  • src-tauri/Cargo.toml
  • src-tauri/Cargo.lock
  • src-tauri/src/pool_manager.rs
  • src-tauri/src/pool_manager_tests.rs
  • src-tauri/tests/socket_integration.rs
  • src-tauri/vendor/sqlx-mysql/** (vendored crate snapshot; the three patched files connection/auth.rs, connection/stream.rs and connection/tls.rs were reviewed in detail)

Reviewed by claude-sonnet-5.5 · Input: 254 · Output: 1.9K · Cached: 375.1K

Review guidance: REVIEW.md from base branch main

@debba
debba merged commit 97cad31 into main Nov 16, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant